package com.millstein.tsinglog.mapper.biz;

import com.millstein.tsinglog.mapper.BaseMapper;
import com.millstein.tsinglog.model.pojo.CarouselImage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface CarouselImageMapper extends BaseMapper<CarouselImage> {

    /**
     * server用，根据id查询轮播图片
     * @param id
     * @return
     */
    @Select("SELECT `id`, `type`, `aid`, `article_title` articleTitle, `article_link` articleLink, " +
            "`pic_url` picUrl, `sort`, `usable`, `expire_time` expireTime, `status`, `create_time` createTime, " +
            "`update_time` updateTime FROM `biz_carousel_image` " +
            "where `status`= 1 and `id` = #{id};")
    CarouselImage selectCarouselImageByPrimaryKeyForServer(@Param("id") Long id);

    /**
     * web用，根据id查询轮播图片
     * @param id
     * @return
     */
    @Select("SELECT `id`, `type`, `aid`, `article_title` articleTitle, `article_link` articleLink, " +
            "`pic_url` picUrl, `sort`, `usable`, `expire_time` expireTime, `status`, `create_time` createTime, " +
            "`update_time` updateTime FROM `biz_carousel_image` " +
            "where `status`= 1 and `usable` = 1 and `id` = #{id};")
    CarouselImage selectCarouselImageByPrimaryKeyForWeb(@Param("id") Long id);
}
